package com.itheima.d4_homework;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

/**
 * 图片的复制
 */
public class Demo3 {
    public static void main(String[] args) throws  Exception{
        //1.创建对象
        File file1 = new File("C:\\Apps\\aaa.jpg");
        File file2 = new File("C:\\Program Files\\Java\\src\\copyaaa.jpg");
        FileInputStream fis = new FileInputStream(file1);
        FileOutputStream fos = new FileOutputStream(file2);
        //2.读取fis的jpg数据
//        byte[] bytes = new byte[1024];
//        while((fis.read(bytes)) != -1){
//            fos.write(bytes,0,bytes.length);
//        }
        byte[] bytes = new byte[1024];
        while((fis.read(bytes)) != -1){
            fos.write(bytes,0,bytes.length);
        }


    }
}
